#ifndef CRANDOM_H
#define CRANDOM_H
#pragma once

const float	MAX_REAL32  =   static_cast<float>(3.4E+38);

enum eRandomConstants
{
	random_constant_a= 1664525,
	random_constant_b= 1013904223,
};

extern int g_random_seed;

inline void set_random_seed(int seed)
{
	g_random_seed = seed;
}

inline int random_int()
{
	g_random_seed = 
		(random_constant_a * g_random_seed)
		+ random_constant_b; 

	return g_random_seed;
}

inline float random_unit_float()
{
	return random_int()
		* 2.3283064365386963e-10f;
}

inline float random_float()
{
	return (random_unit_float()*MAX_REAL32);
}


//template <class T> 
//inline T RandomNumberInRange(T Min, T Max)
//{
//	T Range = Max - Min;
//	T Random = absoluteValue(random_int());
//
//	Random = modulus(Random,Range);
//	Random += Min; 
//
//	return (Random);
//}



inline float RandomNumberInRange(float Min, float Max)
{
	float scalar = random_unit_float();
	float range = Max - Min;
	return (Min + (scalar*range));
}


extern void GaussRandomPair( 
	float& result_a, float& result_b,
	float dMean=0.0f, float dStdDeviation=1.0f);


extern float GaussRandom( float dMean=0.0f, float dStdDeviation=1.0f );

#endif  

